load("//rs/tests:common.bzl", "MAINNET_ENV", "MESSAGE_CANISTER_ENV", "MESSAGE_CANISTER_RUNTIME_DEPS", "UNIVERSAL_VM_RUNTIME_DEPS")
load("//rs/tests:system_tests.bzl", "system_test", "system_test_nns")

package(default_visibility = ["//rs:system-tests-pkg"])

system_test_nns(
    name = "node_assign_test",
    env = MESSAGE_CANISTER_ENV,
    tags = [
        "long_test",  # since it takes longer than 5 minutes.
    ],
    runtime_deps = MESSAGE_CANISTER_RUNTIME_DEPS,
    deps = [
        # Keep sorted.
        "//rs/nns/constants",
        "//rs/nns/governance/api",
        "//rs/registry/canister",
        "//rs/registry/subnet_type",
        "//rs/rust_canisters/canister_test",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
        "@crate_index//:tokio",
    ],
)

system_test_nns(
    name = "node_reassignment_test",
    env = MESSAGE_CANISTER_ENV,
    tags = [
        "long_test",  # since it takes longer than 5 minutes.
    ],
    runtime_deps = MESSAGE_CANISTER_RUNTIME_DEPS,
    deps = [
        # Keep sorted.
        "//rs/registry/subnet_features",
        "//rs/registry/subnet_type",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
    ],
)

system_test_nns(
    name = "node_registration_with_max_rewardable_nodes_test",
    runtime_deps = UNIVERSAL_VM_RUNTIME_DEPS,
    deps = [
        # Keep sorted.
        "//rs/tests/consensus:node_registration_test_common",
        "//rs/tests/driver:ic-system-test-driver",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
    ],
)

system_test_nns(
    name = "node_registration_with_node_allowance_test",
    runtime_deps = UNIVERSAL_VM_RUNTIME_DEPS,
    deps = [
        # Keep sorted.
        "//rs/tests/consensus:node_registration_test_common",
        "//rs/tests/driver:ic-system-test-driver",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
    ],
)

system_test(
    name = "cup_compatibility_test",
    env = MAINNET_ENV,
    runtime_deps = [
        "//rs/tests:cup_compatibility/binaries",
    ],
    deps = [
        # Keep sorted.
        "//rs/recovery",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
        "@crate_index//:tempfile",
    ],
)

system_test_nns(
    name = "ssh_access_to_nodes_test",
    tags = [
        "long_test",  # since it takes longer than 5 minutes.
    ],
    deps = [
        # Keep sorted.
        "//rs/nns/common",
        "//rs/registry/subnet_type",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
    ],
)

system_test_nns(
    name = "unstuck_subnet_test",
    env = MESSAGE_CANISTER_ENV,
    flaky = True,  # flakiness rate of over 2.1% over the month from 2025-02-11 till 2025-03-11.
    tags = [
        "long_test",
    ],
    uses_guestos_test_update = True,
    runtime_deps = MESSAGE_CANISTER_RUNTIME_DEPS + UNIVERSAL_VM_RUNTIME_DEPS,
    deps = [
        "//rs/registry/subnet_type",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
        "@crate_index//:ssh2",
    ],
)

system_test_nns(
    name = "rotate_ecdsa_idkg_key_test",
    env = MESSAGE_CANISTER_ENV,
    tags = [
        "long_test",  # since it takes longer than 5 minutes.
    ],
    runtime_deps = MESSAGE_CANISTER_RUNTIME_DEPS,
    deps = [
        "//rs/interfaces/registry",
        "//rs/protobuf",
        "//rs/registry/keys",
        "//rs/registry/nns_data_provider",
        "//rs/registry/subnet_type",
        "//rs/tests/consensus/tecdsa/utils",
        "//rs/tests/consensus/utils",
        "//rs/tests/driver:ic-system-test-driver",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:slog",
    ],
)
